<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ include file="/WEB-INF/jsp/includes.jsp" %>

<!-- Nette like :-) -->
<c:set var="basePath" value="${pageContext.request.contextPath}" />
<c:set var="actualURL" value='<%=request.getAttribute("javax.servlet.forward.request_uri")%>'/>

 <!-- stylovani -->
        <link href="${basePath}/css/print.css" rel="stylesheet" type="text/css" media="print"/>

<!DOCTYPE html>
<html>
    <head>
        <!-- meta tagy -->
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    </head>
    <body>
        <style>
            table {
                border-collapse: collapse;
            }
            
            table tr td {
                border: 1px solid #e1e1e8;
            }

            table td {
                padding: 10px 5px;
                padding-right: 50px;
            }
        </style>
        
        <h2>Seznam studentů - Response systém </h2>
     
            <%
                 Date date = new Date();
                 SimpleDateFormat dateFormat = new SimpleDateFormat("dd. MMMMM yyyy ");
                 String actualDate = dateFormat.format(date);
             %>
            Datum: <%= actualDate %> <br /> <br /> 
    
            
     <%
          String exportToExcel = request.getParameter("exportToExcel");
          if (exportToExcel != null
                  && exportToExcel.toString().equalsIgnoreCase("YES")) {
              response.setContentType("application/vnd.ms-excel");
              response.setHeader("Content-Disposition", "inline; filename="
                      + "excel.xls");

          }
      %>
            <table>
                <tr>
                    <th>Příjmení</th>
                    <th>Jméno</th> 
                    <th>Ročník</th> 
                    <th>Adresa</th> 
                    <th>Telefon</th> 
                </tr>
                <c:forEach var="s" items="${studenti}">
                    <tr>
                        <td>${s.lastName}</td>
                        <td>${s.firstName}</td>
                        <td>${s.yearOfBirth} </td>
                        <td>${s.address}, ${s.city} </td>
                        <td>${s.telephone} </td>
                    </tr>
                </c:forEach>
            </table>
            <br />
            <br />
        <div class="noPrint">                   
            <% if (exportToExcel == null) { %> <a style="" href="pupilsprint.do?exportToExcel=YES">Export</a>  nebo <% } %>
            <a href="" onclick="window.print()">Tisk</a>
        </div>
    </body>
</html>

